package ai.people.netmon.telegram.config;

import ai.people.netmon.telegram.support.LoginUserArgumentResolver;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * WEB配置类
 *
 * @author pangu
 */
@Slf4j
//@Configuration
@AllArgsConstructor
public class WebConfiguration implements WebMvcConfigurer {

	@Autowired
	StringRedisTemplate stringRedisTemplate;

	/**
	 * Token参数解析
	 *
	 * @param argumentResolvers 解析类
	 */
	@Override
	public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
		//注入用户信息
		argumentResolvers.add(new LoginUserArgumentResolver(stringRedisTemplate));
	}


}
